General Event
For events longer than two words, you use General event with a subtype.
Figure 11
illustrates the contents of a General event.
Figure 11A note request
General event
Table 7Contents of a General event
General event type
|
first nibble value =
1111
|
Part number
|
unique part identifier
|
Event length
|
head: number of words in event
|
Data words
|
depends on subtype
|
Subtype
|
8-bit unsigned subtype
|
Event length
|
tail: must be identical to head
|
Event tail
|
first nibble of last word =
11XX
|
The part number bit field contains a unique identifier that is later used to match Note, Knob, and Controller events to a specific part. For example, to play a note the application uses the part number to specify which instrument will play the note. The General event allows part numbers of up to 12 bits. The standard Note and Controller events allow part numbers of up to 5 bits; the Extended Note and Extended Controller events allow 12-bit part numbers.
The event length bit fields contained in the first and last words of the message are identical and are used as a message format check and to move back and forth through the message. The lengths include the head and tail; the smallest length is 2.
The data words field is a variable length field containing information unique to the subtype of the General event. The subtype bit field indicates the subtype of General event. There are nine subtypes:
-
A note request General event (
kGeneralEventNoteRequest
) has a subtype of 1. It encapsulates the note request data structure used to define the instrument or part. It is used in the tune header.
-
A part key General event (
KGeneralEventPartKey
) has a subtype of 4. It sets a pitch offset for the entire part so that every subsequent note played on that part will be altered in pitch by the specified amount.
-
A tune difference General event (
kGeneralEventTuneDifference
) has a subtype of 5. It contains a standard sequence, with end marker, for the tune difference of a sequence piece. Using a tune difference event is similar to using key frames with compressed video sequences. (This subtype halts QuickTime 2.0 music).
-
An atomic instrument General event (
kGeneralEventAtomicInstrument
) has a subtype of 6. It encapsulates an atomic instrument. It is used in the tune header. It may be used in place of the
kGeneralEventNoteRequest
.
-
A knob General event (
kGeneralEventKnob
) has a subtype of 7. It contains knob ID/knob value pairs. The smallest event is four long words.
-
A MIDI channel General event (
kGeneralEventMIDIChannel
) has a subtype of 8. It is used in a tune header. One long word identifies the MIDI channel it originally came from.
-
A part change General event (
kGeneralEventPartChange
) has a subtype of 9. It is used in a tune sequence where one long word identifies the tune part that can now take over the part's note channel. (This subtype halts QuickTime 2.0 music.)
-
A no-op General event (
kGeneralEventNoOp
) has a subtype of 10. It does nothing in the current version of QuickTime.
-
A notes-used General event (
kGeneralEventUsedNotes
) has a subtype of 11. It is four long words specifying which MIDI notes are actually used. It is used in the tune header.
Macro calls are used to stuff the General event's head and tail long words, but not the structures described above:
qtma_StuffGeneralEvent(w1, w2, instrument, subType, length)
Macros are used to extract field values from the event's head and tail long words.
qtma_XInstrument(m, l)
qtma_GeneralSubtype(m, l)
qtma_GeneralLength(m, l)
© 1997 Apple Computer, Inc.Previous | Chapter Top | Chapter Contents | Next